package com.bite.lesson4;

import java.util.Scanner;

public class Demo_10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            System.out.println(fun(n));
        }
    }

    private static int fun(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += Fun(i);
        }
        return sum;
    }

    private static int Fun(int n) {
        if (n <= 2 || n == 1) {
            return n;
        } else {
            return n * Fun(n - 1);
        }
    }
}

